﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Microsoft.Xna.Framework.Media;
using SMARTMobile.ViewModels;
using SMARTMobile.WinPhone;

namespace SMARTMobile.Views
{
    public partial class ChupHinhMainPage
    {

        public ChupHinhMainPage()
        {
            InitializeComponent();
            this.DataContext = new ChupHinhMainViewModel();
        }

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            if (this.DataContext != null && (this.DataContext is ChupHinhMainViewModel))
            {
                string msg;
                if (NavigationContext.QueryString.TryGetValue("msg", out msg))
                {
                    if (!string.IsNullOrEmpty(msg) && msg.Contains("Step"))
                    {
                        (this.DataContext as ChupHinhMainViewModel).IsTakePicture = true;
                        (this.DataContext as ChupHinhMainViewModel).ChangeImage();
                    }
                }

                ////if (NavigationContext.QueryString.TryGetValue("diachi", out msg))
                ////{
                ////    if (!string.IsNullOrEmpty(msg))
                ////    {
                ////        DiaChi.Text = msg;
                ////    }
                ////}
            }
        }
    }
}